<!--角色设置的编辑权限-->
<template>
  <div class="list-container">
    <div class="search-panel" style="padding: 10px 20px">
      <el-row>
        <el-breadcrumb
          style="display:inline-block;margin-right:30px；height: 38px;line-height: 38px;"
        >
          <el-breadcrumb-item
            >当前角色：{{ this.roleName }}</el-breadcrumb-item
          >
        </el-breadcrumb>
        <!-- <el-button
          @click="confirm"
          type="primary"
          style="position: absolute; right: 0"
        >
          确定
        </el-button> -->
      </el-row>
    </div>
    <div class="table-panel">
      <el-row class="table-operate select-mode row">
        <div
          :class="!dataAuthorization ? 'item  color-1ABC9C' : 'item'"
          @click="dataAuthorization = false"
        >
          功能授权
          <!-- <router-link to="/functionAuthorization"> 功能授权</router-link> -->
        </div>
        <div
          :class="dataAuthorization ? 'item  color-1ABC9C' : 'item'"
          @click="dataAuthorization = true"
        >
          数据授权
          <!-- <router-link to="/dataAuthorization"> 数据授权</router-link> -->
        </div>
      </el-row>
      <div class="authorization">
        <data-authorization v-if="dataAuthorization"></data-authorization>
        <function-authorization
          v-if="!dataAuthorization"
          @changeKey="changeKey"
        ></function-authorization>
      </div>
    </div>
  </div>
</template>

<script>
import DataAuthorization from "./dataAuthorization.vue";
import FunctionAuthorization from "./rolesForm.vue";
export default {
  components: { DataAuthorization, FunctionAuthorization },
  data() {
    return {
      dataAuthorization: false,
      department: "工资结算1部",
      roleName:''
    };
  },
  created() {
    this.roleName = this.$route.query.roleName
  },
  methods: {
    changeKey(res) {
      this.dataAuthorization = res
    },
    confirm() {
      if (!this.function) {
        this.$message({
          type: "warning",
          message: "请选择功能授权!",
        });
      } else if (!this.data) {
        this.$message({
          type: "warning",
          message: "请选择数据授权!",
        });
      } else {
        console.log("提交");
      }
    },
    getData(res) {
      this.data = res;
      console.log(this.data);
    },
    getFunction(res) {
      this.function = res;
    },
  },
};
</script>

<style lang="scss" scoped>
.row {
  display: flex;
  flex-direction: row;
}
.select-mode {
  height: 45px;
  justify-content: center;
  .item {
    height: 35px;
    line-height: 35px;
    background-color: #bbbbbb;
    color: #ffffff;
    width: 110px;
    text-align: center;
    margin: 10px 0;
    font-size: 12px;
  }
  .item:hover {
    cursor: pointer;
  }
  .color-1ABC9C {
    background-color: #1abc9c;
    color: #ffffff;
  }
}
</style>
